﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using WindowsFormsApplication2.All_FORMS.Main_forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication2.All_FORMS.Report_forms.Report
{
    public partial class frmTailanOrder : Form
    {
        static string id1,fname;
        public frmTailanOrder(string id,string name)
        {
            InitializeComponent();
            id1 = id;
            fname = name;
            
        }

       

        private void frmTailanOrder_Load(object sender, EventArgs e)
        {
            crystalReportViewer1.RefreshReport();
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load("D:\\Диплом\\New folder\\WindowsFormsApplication2\\WindowsFormsApplication2\\All FORMS\\Report forms\\Report\\CrystalReportOrder.rpt");
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = id1;
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["Orderdate"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crParameterDiscreteValue.Value = fname;
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["name"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);


            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
    }
}
